# Replication Code: Can (Thin) Populism be manipulated without manipulating Host Ideology? Evidence from a conjoint validation approach
# Script 06: Appendix Analyses and Figures

# Ensure packages from script_01 are loaded
# Requires the following scripts to have been run prior: script_02, script_03, script_04, script_05


#################################
# Appendix A: Overview of Samples
#################################

# Table A1: Sample 1 Demographics
datasummary_skim(demographics_s1, output = 'tabA1.html')

# Table A2: Sample 2 Demographics
datasummary_skim(demographics_s2, output = 'tabA2.html')

# Table A3: Sample 3 Demographics
datasummary_skim(demographics_UK, output = 'tabA3.html')


################################
# Appendix F: Additional Results
################################

## Additional Results for RQ1/H1 

### Figure F1: Ratings Outcomes for RQ1/H1 (S1)

# Model
out_mm_s1_conjoint_listen_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_listen_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s1_conjoint_listen_ranks <- plot(out_mm_s1_conjoint_listen_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism Rating (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s1_conjoint_crooked_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_crooked_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s1_conjoint_crooked_ranks <- plot(out_mm_s1_conjoint_crooked_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism Rating (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s1_conjoint_crooked_ranks <- plot_out_mm_s1_conjoint_crooked_ranks+ theme(axis.title.y=element_blank(),
                                                                                      axis.text.y=element_blank(),
                                                                                      axis.ticks.y=element_blank())


figF1 <- ggarrange(plot_out_mm_s1_conjoint_listen_ranks, plot_out_mm_s1_conjoint_crooked_ranks, ncol=2)

ggsave("figF1.pdf",
       figF1,
       width = 12,
       height = 6)
  

### Figure F2: Average Marginal Component Effects for RQ1/H1 (S1)

# Model
out_amce_s1_conjoint_listen_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_listen, id = ~respondent, estimate = "amce")
# Plot  
plot_amce1 <- plot(out_amce_s1_conjoint_listen_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_listen_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_crooked_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_crooked, id = ~respondent, estimate = "amce")
# Plot
plot_amce2 <-plot(out_amce_s1_conjoint_crooked_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_crooked_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce2 <- plot_amce2+ theme(axis.title.y=element_blank(),
                                axis.text.y=element_blank(),
                                axis.ticks.y=element_blank())

# Model
out_amce_s1_conjoint_listen_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_listen_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce3 <- plot(out_amce_s1_conjoint_listen_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_listen_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_crooked_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_crooked_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce4 <-plot(out_amce_s1_conjoint_crooked_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_crooked_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce4 <- plot_amce4+ theme(axis.title.y=element_blank(),
                                axis.text.y=element_blank(),
                                axis.ticks.y=element_blank())



figF2 <- ggarrange(plot_amce1, plot_amce2, plot_amce3, plot_amce4, ncol=2) 

ggsave("figF2.pdf",
       figF2,
       width = 12,
       height = 8)
  
  
### Figure F3: Binary Outcomes for RQ1/H1 (S2)

# Model
out_mm_s2_conjoint_listen <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_listen, id = ~respondent, estimate = "mm")
#Plot
plot_out_mm_s2_conjoint_listen <- plot(out_mm_s2_conjoint_listen, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s2_conjoint_crooked <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_crooked, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_crooked <- plot(out_mm_s2_conjoint_crooked, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s2_conjoint_crooked <- plot_out_mm_s2_conjoint_crooked+ theme(axis.title.y=element_blank(),
                                                                          axis.text.y=element_blank(),
                                                                          axis.ticks.y=element_blank())


figF3 <-ggarrange(plot_out_mm_s2_conjoint_listen, plot_out_mm_s2_conjoint_crooked, ncol=2)

ggsave("figF3.pdf",
       figF3,
       width = 12,
       height = 6)
  
### Figure F4: Ratings Outcomes for RQ1/H1 (S2)

# Model
out_mm_s2_conjoint_listen_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_listen_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_listen_ranks <- plot(out_mm_s2_conjoint_listen_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s2_conjoint_crooked_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_crooked_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_crooked_ranks <- plot(out_mm_s2_conjoint_crooked_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s2_conjoint_crooked_ranks <- plot_out_mm_s2_conjoint_crooked_ranks+ theme(axis.title.y=element_blank(),
                                                                                      axis.text.y=element_blank(),
                                                                                      axis.ticks.y=element_blank())


figF4 <- ggarrange(plot_out_mm_s2_conjoint_listen_ranks, plot_out_mm_s2_conjoint_crooked_ranks, ncol=2) 

ggsave("figF4.pdf",
       figF4,
       width = 12,
       height = 6)
  
  
### Figure F5: Average Marginal Component Effects for RQ1/H1 (S2)

# Model
out_amce_s2_conjoint_listen_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_listen, id = ~respondent, estimate = "amce")
# Plot  
s2_plot_amce1 <- plot(out_amce_s2_conjoint_listen_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_listen_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s2_conjoint_crooked_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_crooked, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce2 <-plot(out_amce_s2_conjoint_crooked_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_crooked_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

s2_plot_amce2 <- s2_plot_amce2+ theme(axis.title.y=element_blank(),
                                      axis.text.y=element_blank(),
                                      axis.ticks.y=element_blank())

# Model
out_amce_s2_conjoint_listen_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_listen_ranks, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce3 <- plot(out_amce_s2_conjoint_listen_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_listen_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s2_conjoint_crooked_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_crooked_ranks, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce4 <-plot(out_amce_s2_conjoint_crooked_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_crooked_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

s2_plot_amce4 <- s2_plot_amce4+ theme(axis.title.y=element_blank(),
                                      axis.text.y=element_blank(),
                                      axis.ticks.y=element_blank())



figF5 <- ggarrange(s2_plot_amce1, s2_plot_amce2, s2_plot_amce3, s2_plot_amce4, ncol=2) 

ggsave("figF5.pdf",
       figF5,
       width = 12,
       height = 9)
  

### Figure F6: Difference between Sample 1 and Sample 2 for RQ1/H1 (Binary)
  
# Top Panels: People-Centrism Outcome (Binary)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_listen_single <- cj(na.omit(combined_conjoint_listen), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
listen_diff_mms <- cj(na.omit(combined_conjoint_listen), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                      by = ~Sample)

# Plot Outcome
plot_out_mm_comb_conjoint_listen_single <- plot(out_mm_comb_conjoint_listen_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_listen_diff_mms <- plot(listen_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_listen_diff_mms <- plot_listen_diff_mms+ theme(axis.title.y=element_blank(),
                                                    axis.text.y=element_blank(),
                                                    axis.ticks.y=element_blank())



# Bottom Panels: Anti-Elitism Outcome (Binary)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_crooked_single <- cj(na.omit(combined_conjoint_crooked), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
crooked_diff_mms <- cj(na.omit(combined_conjoint_crooked), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                       by = ~Sample)

# Plot Outcome
plot_out_mm_comb_conjoint_crooked_single <- plot(out_mm_comb_conjoint_crooked_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_crooked_diff_mms <- plot(crooked_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_crooked$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_crooked_diff_mms <- plot_crooked_diff_mms+ theme(axis.title.y=element_blank(),
                                                      axis.text.y=element_blank(),
                                                      axis.ticks.y=element_blank())


figF6 <- ggarrange(plot_out_mm_comb_conjoint_listen_single, plot_listen_diff_mms, plot_out_mm_comb_conjoint_crooked_single, plot_crooked_diff_mms, ncol=2) 


ggsave("figF6.pdf",
       figF6,
       width = 12,
       height = 9)
  

### Figure F7: Difference between Sample 1 and Sample 2 for RQ1/H1 (Rating)
  
# Top Panels: People-Centrism Outcome (Rating)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_listen_ranks_single <- cj(na.omit(combined_conjoint_listen_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
listen_ranks_diff_mms <- cj(na.omit(combined_conjoint_listen_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                            by = ~Sample)
# Plot Outcome
plot_out_mm_comb_conjoint_listen_ranks_single <- plot(out_mm_comb_conjoint_listen_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_listen_ranks_diff_mms <- plot(listen_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_comb_conjoint_listen_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_listen_ranks_diff_mms <- plot_listen_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                                axis.text.y=element_blank(),
                                                                axis.ticks.y=element_blank())


# Bottom Panels: Anti-Elitism Outcome (Rating)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_crooked_ranks_single <- cj(na.omit(combined_conjoint_crooked_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
crooked_ranks_diff_mms <- cj(na.omit(combined_conjoint_crooked_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                             by = ~Sample)
# Plot Outcome
plot_out_mm_comb_conjoint_crooked_ranks_single <- plot(out_mm_comb_conjoint_crooked_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_crooked_ranks_diff_mms <- plot(crooked_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_comb_conjoint_listen_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_crooked_ranks_diff_mms <- plot_crooked_ranks_diff_mms + theme(axis.title.y=element_blank(),
                                                                   axis.text.y=element_blank(),
                                                                   axis.ticks.y=element_blank())

figF7 <- ggarrange(plot_out_mm_comb_conjoint_listen_ranks_single, plot_listen_ranks_diff_mms, plot_out_mm_comb_conjoint_crooked_ranks_single, plot_crooked_ranks_diff_mms, ncol=2)


ggsave("figF7.pdf",
       figF7,
       width = 12,
       height = 9)
  
  
## Additional Results for RQ2/H2
  
### Figure F8: Ratings Outcomes for RQ2/H2 (S1)

# Model
out_mm_s1_conjoint_immig_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s1_conjoint_immig_ranks <- plot(out_mm_s1_conjoint_immig_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Position (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_immig_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s1_conjoint_cons_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s1_conjoint_cons_ranks <- plot(out_mm_s1_conjoint_cons_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_cons_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s1_conjoint_cons_ranks <- plot_out_mm_s1_conjoint_cons_ranks+ theme(axis.title.y=element_blank(),
                                                                    axis.text.y=element_blank(),
                                                                    axis.ticks.y=element_blank())


figF8 <- ggarrange(plot_out_mm_s1_conjoint_immig_ranks, plot_out_mm_s1_conjoint_cons_ranks, ncol=2) 

ggsave("figF8.pdf",
       figF8,
       width = 12,
       height = 6)
  
  
### Figure F9: Average Marginal Component Effects for RQ2/H2 (S1)

# Model
out_amce_s1_conjoint_immig_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig <- plot(out_amce_s1_conjoint_immig_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_immig_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_cons_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons <-plot(out_amce_s1_conjoint_cons_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_cons_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons <- plot_amce_cons+ theme(axis.title.y=element_blank(),
                                        axis.text.y=element_blank(),
                                        axis.ticks.y=element_blank())

# Model
out_amce_s1_conjoint_immig_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_ranks <- plot(out_amce_s1_conjoint_immig_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_immig_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_cons_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_ranks <-plot(out_amce_s1_conjoint_cons_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_cons_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_ranks <- plot_amce_cons_ranks+ theme(axis.title.y=element_blank(),
                                                    axis.text.y=element_blank(),
                                                    axis.ticks.y=element_blank())

figF9 <- ggarrange(plot_amce_immig, plot_amce_cons, plot_amce_immig_ranks, plot_amce_cons_ranks, ncol=2) 

ggsave("figF9.pdf",
       figF9,
       width = 12,
       height = 8)

  
### Figure F10: Average Marginal Component Effects for RQ2/H2 (S1, Alternative Baseline)
  
# Model
out_amce_s1_conjoint_immig_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_s1_b <- plot(out_amce_s1_conjoint_immig_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S1, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_immig_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_cons_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_s1_b <-plot(out_amce_s1_conjoint_cons_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S1, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_cons_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_s1_b <- plot_amce_cons_s1_b+ theme(axis.title.y=element_blank(),
                                                  axis.text.y=element_blank(),
                                                  axis.ticks.y=element_blank())
# Model
out_amce_s1_conjoint_immig_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_ranks_s1_b <- plot(out_amce_s1_conjoint_immig_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S1, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_immig_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s1_conjoint_cons_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_ranks_s1_b <-plot(out_amce_s1_conjoint_cons_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S1, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s1_conjoint_cons_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_ranks_s1_b <- plot_amce_cons_ranks_s1_b+ theme(axis.title.y=element_blank(),
                                                              axis.text.y=element_blank(),
                                                              axis.ticks.y=element_blank())


figF10 <- ggarrange(plot_amce_immig_s1_b, plot_amce_cons_s1_b, plot_amce_immig_ranks_s1_b, plot_amce_cons_ranks_s1_b, ncol=2) 

ggsave("figF10.pdf",
       figF10,
       width = 12,
       height = 8)
  
### Figure F11: Binary Outcomes for RQ2/H2 (S2)

# Model
out_mm_s2_conjoint_immig <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_immig <- plot(out_mm_s2_conjoint_immig, feature_headers = FALSE) +
ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s2_conjoint_cons <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_cons <- plot(out_mm_s2_conjoint_cons, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_cons$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s2_conjoint_cons <- plot_out_mm_s2_conjoint_cons+ theme(axis.title.y=element_blank(),
                                                                    axis.text.y=element_blank(),
                                                                    axis.ticks.y=element_blank())

figF11 <- ggarrange(plot_out_mm_s2_conjoint_immig, plot_out_mm_s2_conjoint_cons, ncol=2) 

ggsave("figF11.pdf",
       figF11,
       width = 12,
       height = 6)

  
### Figure F12: Rating Outcomes for RQ2/H2 (S2)

# Model
out_mm_s2_conjoint_immig_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_immig <- plot(out_mm_s2_conjoint_immig_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Position (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s2_conjoint_cons_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s2_conjoint_cons <- plot(out_mm_s2_conjoint_cons_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_cons_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s2_conjoint_cons <- plot_out_mm_s2_conjoint_cons+ theme(axis.title.y=element_blank(),
                                                                    axis.text.y=element_blank(),
                                                                    axis.ticks.y=element_blank())

figF12 <- ggarrange(plot_out_mm_s2_conjoint_immig, plot_out_mm_s2_conjoint_cons, ncol=2) 

ggsave("figF12.pdf",
       figF12,
       width = 12,
       height = 6)
  
  
### Figure F13: Average Marginal Component Effects for RQ2/H2 (S2)
  
# Model
out_amce_s2_conjoint_immig_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce_immig <- plot(out_amce_s2_conjoint_immig_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_immig_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s2_conjoint_cons_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce_cons <-plot(out_amce_s2_conjoint_cons_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_cons_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

s2_plot_amce_cons <- s2_plot_amce_cons+ theme(axis.title.y=element_blank(),
                                              axis.text.y=element_blank(),
                                              axis.ticks.y=element_blank())

# Model
out_amce_s2_conjoint_immig_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig_ranks, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce_immig_ranks <- plot(out_amce_s2_conjoint_immig_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_immig_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

#Model
out_amce_s2_conjoint_cons_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons_ranks, id = ~respondent, estimate = "amce")
# Plot
s2_plot_amce_cons_ranks <-plot(out_amce_s2_conjoint_cons_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_cons_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

s2_plot_amce_cons_ranks <- s2_plot_amce_cons_ranks+ theme(axis.title.y=element_blank(),
                                                          axis.text.y=element_blank(),
                                                          axis.ticks.y=element_blank())

figF13 <- ggarrange(s2_plot_amce_immig, s2_plot_amce_cons, s2_plot_amce_immig_ranks, s2_plot_amce_cons_ranks, ncol=2) 

ggsave("figF13.pdf",
       figF13,
       width = 12,
       height = 9)
  

### Figure F14: Average Marginal Component Effects for RQ2/H2 (S2, Alternative Baseline)

# Model
out_amce_s2_conjoint_immig_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_S2_b <- plot(out_amce_s2_conjoint_immig_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S2, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_immig_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s2_conjoint_cons_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_S2_b <-plot(out_amce_s2_conjoint_cons_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S2, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_cons_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_S2_b <- plot_amce_cons_S2_b+ theme(axis.title.y=element_blank(),
                                                  axis.text.y=element_blank(),
                                                  axis.ticks.y=element_blank())
# Model
out_amce_s2_conjoint_immig_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_immig_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_ranks_S2_b <- plot(out_amce_s2_conjoint_immig_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S2, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_immig_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s2_conjoint_cons_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_ranks_S2_b <-plot(out_amce_s2_conjoint_cons_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S2, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s2_conjoint_cons_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_ranks_S2_b <- plot_amce_cons_ranks_S2_b+ theme(axis.title.y=element_blank(),
                                                              axis.text.y=element_blank(),
                                                              axis.ticks.y=element_blank())

figF14 <- ggarrange(plot_amce_immig_S2_b, plot_amce_cons_S2_b, plot_amce_immig_ranks_S2_b, plot_amce_cons_ranks_S2_b, ncol=2) 

ggsave("figF14.pdf",
       figF14,
       width = 12,
       height = 9)
  
  
## Additional Results for RQ3/H3
  
### Figure F15: Difference in Rating Outcomes for RQ3/H3

# Top Panels: Immigration Outcome (Ratings)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_immig_ranks_single <- cj(na.omit(combined_conjoint_immig_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
immig_ranks_diff_mms <- cj(na.omit(combined_conjoint_immig_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                           by = ~Sample)

# Plot Outcome
plot_out_mm_comb_conjoint_immig_ranks_single <- plot(out_mm_comb_conjoint_immig_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Stance (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_immig_ranks_diff_mms <- plot(immig_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_comb_conjoint_immig_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_immig_ranks_diff_mms <- plot_immig_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                              axis.text.y=element_blank(),
                                                              axis.ticks.y=element_blank())


# Bottom Panels: Conservatism Outcome (Ratings)

# Model and Difference in Marginal Means
out_mm_comb_conjoint_cons_ranks_single <- cj(na.omit(combined_conjoint_cons_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
cons_ranks_diff_mms <- cj(na.omit(combined_conjoint_cons_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                          by = ~Sample)

# Plot Outcomes
plot_out_mm_comb_conjoint_cons_ranks_single <- plot(out_mm_comb_conjoint_cons_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MM
plot_cons_ranks_diff_mms <- plot(cons_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_comb_conjoint_immig_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_cons_ranks_diff_mms <- plot_cons_ranks_diff_mms + theme(axis.title.y=element_blank(),
                                                             axis.text.y=element_blank(),
                                                             axis.ticks.y=element_blank())

figF15 <- ggarrange(plot_out_mm_comb_conjoint_immig_ranks_single, plot_immig_ranks_diff_mms, plot_out_mm_comb_conjoint_cons_ranks_single, plot_cons_ranks_diff_mms, ncol=2) 


ggsave("figF15.pdf",
       figF15,
       width = 12,
       height = 9)
  

### Figure F16: Average Marginal Component Effects for RQ3/H3
  
# Top Panels: Immigration Outcome (Binary)

# Model and Differences in AMCE
out_amce_comb_conjoint_immig_single <- cj(na.omit(combined_conjoint_immig), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "amce", by = ~Sample)
immig_diff_amce <- cj(na.omit(combined_conjoint_immigb), selected ~ Antielitism+Peoplecentrism+Filler, id = ~respondent, estimate = "amce_diff", 
                      by = ~Sample)

# Plot AMCE Model
plot_out_amce_comb_conjoint_immig_single <- plot(out_amce_comb_conjoint_immig_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in AMCE
plot_immig_diff_amce <- plot(immig_diff_amce, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in AMCES")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_immig_diff_amce <- plot_immig_diff_amce+ theme(axis.title.y=element_blank(),
                                                    axis.text.y=element_blank(),
                                                    axis.ticks.y=element_blank())


# Bottom Panels: Conservatism Outcome (Binary)

# Model and Differences in AMCE
out_amce_comb_conjoint_cons_single <- cj(na.omit(combined_conjoint_cons), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "amce", by = ~Sample)
cons_diff_amce <- cj(na.omit(combined_conjoint_consb), selected ~ Antielitism+Peoplecentrism+Filler, id = ~respondent, estimate = "amce_diff", 
                     by = ~Sample)

# Plot AMCE Model
plot_out_amce_comb_conjoint_cons_single <- plot(out_amce_comb_conjoint_cons_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in AMCE
plot_cons_diff_amce <- plot(cons_diff_amce, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in AMCES")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_cons_diff_amce <- plot_cons_diff_amce+ theme(axis.title.y=element_blank(),
                                                  axis.text.y=element_blank(),
                                                  axis.ticks.y=element_blank())

figF16 <- ggarrange(plot_out_amce_comb_conjoint_immig_single, plot_immig_diff_amce, plot_out_amce_comb_conjoint_cons_single, plot_cons_diff_amce, ncol=2) 


ggsave("figF16.pdf",
       figF16,
       width = 12,
       height = 9)
  

### Figure F17: Average Marginal Component Effects for RQ3/H3 (Alternative Baseline)
  
# Top Panels: Immigration Outcome (Binary, Alternative Baseline)

# Model and Differences in AMCE
out_amce_comb_conjoint_immig_single_b <- cj(na.omit(combined_conjoint_immig_b), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "amce", by = ~Sample)
immig_diff_amce_b <- cj(na.omit(combined_conjoint_immig_bb), selected ~ Antielitism+Peoplecentrism+Filler, id = ~respondent, estimate = "amce_diff", 
                        by = ~Sample)

# Plot AMCE
plot_out_amce_comb_conjoint_immig_single_b <- plot(out_amce_comb_conjoint_immig_single_b, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in AMCE
plot_immig_diff_amce_b <- plot(immig_diff_amce_b, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in AMCES")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_immig_diff_amce_b <- plot_immig_diff_amce_b+ theme(axis.title.y=element_blank(),
                                                        axis.text.y=element_blank(),
                                                        axis.ticks.y=element_blank())

# Bottom Panels: Conservatism Outcome (Binary, Alternative Baseline)

# Model and Differences in AMCE
out_amce_comb_conjoint_cons_single_b <- cj(na.omit(combined_conjoint_cons_b), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "amce", by = ~Sample)
cons_diff_amce_b <- cj(na.omit(combined_conjoint_cons_bb), selected ~ Antielitism+Peoplecentrism+Filler, id = ~respondent, estimate = "amce_diff", 
                       by = ~Sample)

# Plot AMCE
plot_out_amce_comb_conjoint_cons_single_b <- plot(out_amce_comb_conjoint_cons_single_b, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in AMCE
plot_cons_diff_amce_b <- plot(cons_diff_amce_b, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in AMCES")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s2_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_cons_diff_amce_b <- plot_cons_diff_amce_b+ theme(axis.title.y=element_blank(),
                                                      axis.text.y=element_blank(),
                                                      axis.ticks.y=element_blank())

figF17 <- ggarrange(plot_out_amce_comb_conjoint_immig_single_b, plot_immig_diff_amce_b, plot_out_amce_comb_conjoint_cons_single_b, plot_cons_diff_amce_b, ncol=2) 


ggsave("figF17.pdf",
       figF17,
       width = 12,
       height = 8)
  
## Folded Conservatism Measure

# Sample 1: Create Folded Outcome
s1_conjoint_cons_ranks_folded <- s1_conjoint_cons_ranks
s1_conjoint_cons_ranks_folded$selected <- car::recode(s1_conjoint_cons_ranks_folded$selected, "3=1; 2=2; 4=2; 1=3; 5=3")

# Sample 2: Create Folded Outcome
s2_conjoint_cons_ranks_folded <- s2_conjoint_cons_ranks
s2_conjoint_cons_ranks_folded$selected <- car::recode(s2_conjoint_cons_ranks_folded$selected, "3=1; 2=2; 4=2; 1=3; 5=3")

### Figure F18: Folded Conservatism Measure

# Model
out_s1_folded <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_ranks_folded, id = ~respondent, estimate = "mm")
# Plot
plot_out_s1_folded <- plot(out_s1_folded, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, Folded, S1)")+
  scale_colour_manual(values=rep("black", length(unique(out_s1_folded$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_s2_folded <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, data = s2_conjoint_cons_ranks_folded, id = ~respondent, estimate = "mm")
# Plot
plot_out_s2_folded <- plot(out_s2_folded, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, Folded, S2)")+
  scale_colour_manual(values=rep("black", length(unique(out_s2_folded$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

figF18 <- ggarrange(plot_out_s1_folded, plot_out_s2_folded, ncol=1) 

ggsave("figF18.pdf",
       figF18,
       width = 8,
       height = 12)


###################################
# Appendix G: Heterogeneous Effects
###################################

# Load US Partisanship Data (dataset was created using script_02)
partisanship_df_US <- read.csv('partisanship_df_US.csv', header=T, stringsAsFactors = T)

# Merge Conjoint and Partisanship Data (S1 and S2)
s1_conjoint_listen_pid <- left_join(s1_conjoint_listen, partisanship_df_US, by = "Response.ID")
s2_conjoint_listen_pid <- left_join(s2_conjoint_listen, partisanship_df_US, by = "Response.ID")
s1_conjoint_crooked_pid <- left_join(s1_conjoint_crooked, partisanship_df_US, by = "Response.ID")
s2_conjoint_crooked_pid <- left_join(s2_conjoint_crooked, partisanship_df_US, by = "Response.ID")
s1_conjoint_immig_pid <- left_join(s1_conjoint_immig, partisanship_df_US, by = "Response.ID")
s2_conjoint_immig_pid <- left_join(s2_conjoint_immig, partisanship_df_US, by = "Response.ID")
s1_conjoint_cons_pid <- left_join(s1_conjoint_cons, partisanship_df_US, by = "Response.ID")
s2_conjoint_cons_pid <- left_join(s2_conjoint_cons, partisanship_df_US, by = "Response.ID")
s1_conjoint_listen_ranks_pid <- left_join(s1_conjoint_listen_ranks, partisanship_df_US, by = "Response.ID")
s2_conjoint_listen_ranks_pid <- left_join(s2_conjoint_listen_ranks, partisanship_df_US, by = "Response.ID")
s1_conjoint_crooked_ranks_pid <- left_join(s1_conjoint_crooked_ranks, partisanship_df_US, by = "Response.ID")
s2_conjoint_crooked_ranks_pid <- left_join(s2_conjoint_crooked_ranks, partisanship_df_US, by = "Response.ID")
s1_conjoint_immig_ranks_pid <- left_join(s1_conjoint_immig_ranks, partisanship_df_US, by = "Response.ID")
s2_conjoint_immig_ranks_pid <- left_join(s2_conjoint_immig_ranks, partisanship_df_US, by = "Response.ID")
s1_conjoint_cons_ranks_pid <- left_join(s1_conjoint_cons_ranks, partisanship_df_US, by = "Response.ID")
s2_conjoint_cons_ranks_pid <- left_join(s2_conjoint_cons_ranks, partisanship_df_US, by = "Response.ID")

# Formal test of Heterogeneity by Partisanship (S1 and S2)
cj_anova(na.omit(s1_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s1_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s2_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)

# Merge Conjoint and Populist Attitudes Data (S1 and S2)

# Load Populist Attitudes Data (dataset was created using script_02)
populism_df_US <- read.csv('populism_df_US.csv', header=T, stringsAsFactors = T)

# Sample 1
s1_conjoint_listen_pop <- left_join(s1_conjoint_listen, populism_df_US, by = "Response.ID")
s1_conjoint_listen_ranks_pop <- left_join(s1_conjoint_listen_ranks, populism_df_US, by = "Response.ID")
s1_conjoint_crooked_pop <- left_join(s1_conjoint_crooked, populism_df_US, by = "Response.ID")
s1_conjoint_crooked_ranks_pop <- left_join(s1_conjoint_crooked_ranks, populism_df_US, by = "Response.ID")
s1_conjoint_immig_pop <- left_join(s1_conjoint_immig, populism_df_US, by = "Response.ID")
s1_conjoint_immig_ranks_pop <- left_join(s1_conjoint_immig_ranks, populism_df_US, by = "Response.ID")
s1_conjoint_cons_pop <- left_join(s1_conjoint_cons, populism_df_US, by = "Response.ID")
s1_conjoint_cons_ranks_pop <- left_join(s1_conjoint_cons_ranks, populism_df_US, by = "Response.ID")

# Sample 2
s2_conjoint_listen_pop <- left_join(s2_conjoint_listen, populism_df_US, by = "Response.ID")
s2_conjoint_listen_ranks_pop <- left_join(s2_conjoint_listen_ranks, populism_df_US, by = "Response.ID")
s2_conjoint_crooked_pop <- left_join(s2_conjoint_crooked, populism_df_US, by = "Response.ID")
s2_conjoint_crooked_ranks_pop <- left_join(s2_conjoint_crooked_ranks, populism_df_US, by = "Response.ID")
s2_conjoint_immig_pop <- left_join(s2_conjoint_immig, populism_df_US, by = "Response.ID")
s2_conjoint_immig_ranks_pop <- left_join(s2_conjoint_immig_ranks, populism_df_US, by = "Response.ID")
s2_conjoint_cons_pop <- left_join(s2_conjoint_cons, populism_df_US, by = "Response.ID")
s2_conjoint_cons_ranks_pop <- left_join(s2_conjoint_cons_ranks, populism_df_US, by = "Response.ID")

# Formal test of Heterogeneity by Populist Attitudes (S1 and S2)
cj_anova(na.omit(s1_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s1_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s2_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)


### Figure G1: Binary Outcomes for RQ1/H1 (S1) by Partisanship

# Model: People-Centrism Outcome (Binary) by Partisanship
out_mm_s1_conjoint_listen_pid <- cj(na.omit(s1_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_listen_pid <- plot(out_mm_s1_conjoint_listen_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S1)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Anti-Elitism Outcome (Binary) by Partisanship
out_mm_s1_conjoint_crooked_pid <- cj(na.omit(s1_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_crooked_pid <- plot(out_mm_s1_conjoint_crooked_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S1)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s1_conjoint_crooked_pid <- plot_out_mm_s1_conjoint_crooked_pid+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank())

figG1 <- ggarrange(plot_out_mm_s1_conjoint_listen_pid, plot_out_mm_s1_conjoint_crooked_pid, ncol=2)

ggsave("figG1.pdf",
       figG1,
       width = 12,
       height = 6)
  

### Figure G2: Binary Outcomes for RQ1/H1 (S2) by Partisanship
  
# Model: People-Centrism Outcome (Binary) by Partisanship
out_mm_s2_conjoint_listen_pid <- cj(na.omit(s2_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_listen_pid <- plot(out_mm_s2_conjoint_listen_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S2)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Anti-Elitism Outcome (Binary) by Partisanship
out_mm_s2_conjoint_crooked_pid <- cj(na.omit(s2_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_crooked_pid <- plot(out_mm_s2_conjoint_crooked_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S2)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s2_conjoint_crooked_pid <- plot_out_mm_s2_conjoint_crooked_pid+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank())

figG2 <- ggarrange(plot_out_mm_s2_conjoint_listen_pid, plot_out_mm_s2_conjoint_crooked_pid, ncol=2)

ggsave("figG2.pdf",
       figG2,
       width = 12,
       height = 6)
  

### Figure G3: Rating Outcomes for RQ1/H1 (S1) by Partisanship

# Model: People-Centrism Outcome (Ratings) by Partisanship
out_mm_s1_conjoint_listen_ranks_pid <- cj(na.omit(s1_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_listen_ranks_pid <- plot(out_mm_s1_conjoint_listen_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S1)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Anti-Elitism Outcome (Ratings) by Partisanship
out_mm_s1_conjoint_crooked_ranks_pid <- cj(na.omit(s1_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_crooked_ranks_pid <- plot(out_mm_s1_conjoint_crooked_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitsm (Rating, S1)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s1_conjoint_crooked_ranks_pid <- plot_out_mm_s1_conjoint_crooked_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())

figG3 <- ggarrange(plot_out_mm_s1_conjoint_listen_ranks_pid, plot_out_mm_s1_conjoint_crooked_ranks_pid, ncol=2) 

ggsave("figG3.pdf",
       figG3,
       width = 12,
       height = 6)
  

### Figure G4: Rating Outcomes for RQ1/H1 (S2) by Partisanship

# Model: People-Centrism Outcome (Ratings) by Partisanship
out_mm_s2_conjoint_listen_ranks_pid <- cj(na.omit(s2_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_listen_ranks_pid <- plot(out_mm_s2_conjoint_listen_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S2)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Anti-Elitism Outcome (Ratings) by Partisanship
out_mm_s2_conjoint_crooked_ranks_pid <- cj(na.omit(s2_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_crooked_ranks_pid <- plot(out_mm_s2_conjoint_crooked_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating, S2)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s2_conjoint_crooked_ranks_pid <- plot_out_mm_s2_conjoint_crooked_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())

figG4 <- ggarrange(plot_out_mm_s2_conjoint_listen_ranks_pid, plot_out_mm_s2_conjoint_crooked_ranks_pid, ncol=2) 

ggsave("figG4.pdf",
       figG4,
       width = 12,
       height = 6)
  
  
### Figure G5: Binary Outcomes for RQ2/H2 (S1) by Partisanship

# Model: Immigration Outcome (Binary) by Partisanship  
out_mm_s1_conjoint_immig_pid <- cj(na.omit(s1_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_immig_pid <- plot(out_mm_s1_conjoint_immig_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S1)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Conservatism Outcome (Binary) by Partisanship 
out_mm_s1_conjoint_cons_pid <- cj(na.omit(s1_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_cons_pid <- plot(out_mm_s1_conjoint_cons_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S1)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s1_conjoint_cons_pid <- plot_out_mm_s1_conjoint_cons_pid+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figG5 <- ggarrange(plot_out_mm_s1_conjoint_immig_pid, plot_out_mm_s1_conjoint_cons_pid, ncol=2) 

ggsave("figG5.pdf",
       figG5,
       width = 12,
       height = 6)
  

### Figure G6: Binary Outcomes for RQ2/H2 (S2) by Partisanship

# Model: Immigration Outcome (Binary) by Partisanship  
out_mm_s2_conjoint_immig_pid <- cj(na.omit(s2_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_immig_pid <- plot(out_mm_s2_conjoint_immig_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S2)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Conservatism Outcome (Binary) by Partisanship  
out_mm_s2_conjoint_cons_pid <- cj(na.omit(s2_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_cons_pid <- plot(out_mm_s2_conjoint_cons_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S2)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s2_conjoint_cons_pid <- plot_out_mm_s2_conjoint_cons_pid+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figG6 <- ggarrange(plot_out_mm_s2_conjoint_immig_pid, plot_out_mm_s2_conjoint_cons_pid, ncol=2) 

ggsave("figG6.pdf",
       figG6,
       width = 12,
       height = 6)
  
  
### Figure G7: Rating Outcomes for RQ2/H2 (S1) by Partisanship

# Model: Immigration Outcome (Ratings) by Partisanship  
out_mm_s1_conjoint_immig_ranks_pid <- cj(na.omit(s1_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_immig_ranks_pid <- plot(out_mm_s1_conjoint_immig_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S1)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Conservatism Outcome (Ratings) by Partisanship  
out_mm_s1_conjoint_cons_ranks_pid <- cj(na.omit(s1_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s1_conjoint_cons_ranks_pid <- plot(out_mm_s1_conjoint_cons_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (Rating, S1)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s1_conjoint_cons_ranks_pid <- plot_out_mm_s1_conjoint_cons_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

figG7 <- ggarrange(plot_out_mm_s1_conjoint_immig_ranks_pid, plot_out_mm_s1_conjoint_cons_ranks_pid, ncol=2)

ggsave("figG7.pdf",
       figG7,
       width = 12,
       height = 6)
  

### Figure G8: Rating Outcomes for RQ2/H2 (S2) by Partisanship

# Model: Immigration Outcome (Ratings) by Partisanship  
out_mm_s2_conjoint_immig_ranks_pid <- cj(na.omit(s2_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_immig_ranks_pid <- plot(out_mm_s2_conjoint_immig_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S2)")+
  scale_color_manual(values=c("blue4", "red3"))

# Model: Conservatism Outcome (Ratings) by Partisanship 
out_mm_s2_conjoint_cons_ranks_pid <- cj(na.omit(s2_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s2_conjoint_cons_ranks_pid <- plot(out_mm_s2_conjoint_cons_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (Rating, S2)")+
  scale_color_manual(values=c("blue4", "red3"))

plot_out_mm_s2_conjoint_cons_ranks_pid <- plot_out_mm_s2_conjoint_cons_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

figG8 <- ggarrange(plot_out_mm_s2_conjoint_immig_ranks_pid, plot_out_mm_s2_conjoint_cons_ranks_pid, ncol=2) 

ggsave("figG8.pdf",
       figG8,
       width = 12,
       height = 6)
  
  
## Heterogeneity by Populist Attitudes 
  
### Figure G9: Binary Outcomes for RQ1/H1 (S1) by Populist Attitudes

# Model: People-Centrism Outcome (Binary) by Populist Attitudes   
out_mm_s1_conjoint_listen_pop <- cj(na.omit(s1_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_listen_pop <- plot(out_mm_s1_conjoint_listen_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S1)")+
  scale_color_manual(values=c("black", "maroon"))

# Model:Anti-Elitism Outcome (Binary) by Populist Attitudes   
out_mm_s1_conjoint_crooked_pop <- cj(na.omit(s1_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_crooked_pop <- plot(out_mm_s1_conjoint_crooked_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S1)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s1_conjoint_crooked_pop <- plot_out_mm_s1_conjoint_crooked_pop+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank())

figG9 <- ggarrange(plot_out_mm_s1_conjoint_listen_pop, plot_out_mm_s1_conjoint_crooked_pop, ncol=2)

ggsave("figG9.pdf",
       figG9,
       width = 12,
       height = 6)
  

### Figure G10: Binary Outcomes for RQ1/H1 (S2) by Populist Attitudes

# Model: People-Centrism Outcome (Binary) by Populist Attitudes   
out_mm_s2_conjoint_listen_pop <- cj(na.omit(s2_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_listen_pop <- plot(out_mm_s2_conjoint_listen_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S2)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Anti-Elitism Outcome (Binary) by Populist Attitudes
out_mm_s2_conjoint_crooked_pop <- cj(na.omit(s2_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_crooked_pop <- plot(out_mm_s2_conjoint_crooked_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S2)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s2_conjoint_crooked_pop <- plot_out_mm_s2_conjoint_crooked_pop+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank())

figG10 <- ggarrange(plot_out_mm_s2_conjoint_listen_pop, plot_out_mm_s2_conjoint_crooked_pop, ncol=2) 

ggsave("figG10.pdf",
       figG10,
       width = 12,
       height = 6)
  
  
### Figure G11: Rating Outcomes for RQ1/H1 (S1) by Populist Attitudes

# Model: People-Centrism Outcome (Ratings) by Populist Attitudes 
out_mm_s1_conjoint_listen_ranks_pop <- cj(na.omit(s1_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_listen_ranks_pop <- plot(out_mm_s1_conjoint_listen_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S1)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Anti-Elitism Outcome (Ratings) by Populist Attitudes 
out_mm_s1_conjoint_crooked_ranks_pop <- cj(na.omit(s1_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_crooked_ranks_pop <- plot(out_mm_s1_conjoint_crooked_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitsm (Rating, S1)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s1_conjoint_crooked_ranks_pop <- plot_out_mm_s1_conjoint_crooked_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())

figG11 <- ggarrange(plot_out_mm_s1_conjoint_listen_ranks_pop, plot_out_mm_s1_conjoint_crooked_ranks_pop, ncol=2)

ggsave("figG11.pdf",
       figG11,
       width = 12,
       height = 6)
  
  
### Figure G12: Rating Outcomes for RQ1/H1 (S2) by Populist Attitudes

# Model: People-Centrism Outcome (Ratings) by Populist Attitudes 
out_mm_s2_conjoint_listen_ranks_pop <- cj(na.omit(s2_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_listen_ranks_pop <- plot(out_mm_s2_conjoint_listen_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S2)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Anti-Elitism Outcome (Ratings) by Populist Attitudes 
out_mm_s2_conjoint_crooked_ranks_pop <- cj(na.omit(s2_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_crooked_ranks_pop <- plot(out_mm_s2_conjoint_crooked_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitsm (Rating, S2)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s2_conjoint_crooked_ranks_pop <- plot_out_mm_s2_conjoint_crooked_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())

figG12 <- ggarrange(plot_out_mm_s2_conjoint_listen_ranks_pop, plot_out_mm_s2_conjoint_crooked_ranks_pop, ncol=2)

ggsave("figG12.pdf",
       figG12,
       width = 12,
       height = 6)
  

### Figure G13: Binary Outcomes for RQ2/H2 (S1) by Populist Attitudes

# Model: Immigration Outcome (Binary) by Populist Attitudes   
out_mm_s1_conjoint_immig_pop <- cj(na.omit(s1_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_immig_pop <- plot(out_mm_s1_conjoint_immig_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S1)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Binary) by Populist Attitudes   
out_mm_s1_conjoint_cons_pop <- cj(na.omit(s1_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_cons_pop <- plot(out_mm_s1_conjoint_cons_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S1)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s1_conjoint_cons_pop <- plot_out_mm_s1_conjoint_cons_pop+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figG13 <- ggarrange(plot_out_mm_s1_conjoint_immig_pop, plot_out_mm_s1_conjoint_cons_pop, ncol=2)

ggsave("figG13.pdf",
       figG13,
       width = 12,
       height = 6)
  

### Figure G14: Binary Outcomes for RQ2/H2 (S2) by Populist Attitudes

# Model: Immigration Outcome (Binary) by Populist Attitudes   
out_mm_s2_conjoint_immig_pop <- cj(na.omit(s2_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_immig_pop <- plot(out_mm_s2_conjoint_immig_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S2)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Binary) by Populist Attitudes   
out_mm_s2_conjoint_cons_pop <- cj(na.omit(s2_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_cons_pop <- plot(out_mm_s2_conjoint_cons_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S2)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s2_conjoint_cons_pop <- plot_out_mm_s2_conjoint_cons_pop+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figG14 <- ggarrange(plot_out_mm_s2_conjoint_immig_pop, plot_out_mm_s2_conjoint_cons_pop, ncol=2)

ggsave("figG14.pdf",
       figG14,
       width = 12,
       height = 6)
  

### Figure G15: Rating Outcomes for RQ2/H2 (S1) by Populist Attitudes

# Model: Immigration Outcome (Ratings) by Populist Attitudes   
out_mm_s1_conjoint_immig_ranks_pop <- cj(na.omit(s1_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_immig_ranks_pop <- plot(out_mm_s1_conjoint_immig_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S1)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Ratings) by Populist Attitudes 
out_mm_s1_conjoint_cons_ranks_pop <- cj(na.omit(s1_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s1_conjoint_cons_ranks_pop <- plot(out_mm_s1_conjoint_cons_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S1)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s1_conjoint_cons_ranks_pop <- plot_out_mm_s1_conjoint_cons_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

figG15 <- ggarrange(plot_out_mm_s1_conjoint_immig_ranks_pop, plot_out_mm_s1_conjoint_cons_ranks_pop, ncol=2)

ggsave("figG15.pdf",
       figG15,
       width = 12,
       height = 6)
  

### Figure G16: Rating Outcomes for RQ2/H2 (S2) by Populist Attitudes

# Model: Immigration Outcome (Ratings) by Populist Attitudes   
out_mm_s2_conjoint_immig_ranks_pop <- cj(na.omit(s2_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_immig_ranks_pop <- plot(out_mm_s2_conjoint_immig_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S2)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Ratings) by Populist Attitudes   
out_mm_s2_conjoint_cons_ranks_pop <- cj(na.omit(s2_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler+Partisanship, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s2_conjoint_cons_ranks_pop <- plot(out_mm_s2_conjoint_cons_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S2)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s2_conjoint_cons_ranks_pop <- plot_out_mm_s2_conjoint_cons_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

figG16 <- ggarrange(plot_out_mm_s2_conjoint_immig_ranks_pop, plot_out_mm_s2_conjoint_cons_ranks_pop, ncol=2)

ggsave("figG16.pdf",
       figG16,
       width = 12,
       height = 6)


####################################
# Appendix I: UK Replication Results
####################################

# Formal Tests of Sample 1 vs Sample 3 Heterogeneity
cj_anova(s1s3_combined_conjoint_listen, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_listen_ranks, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_crooked, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_crooked_ranks, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_immig, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_immig_ranks, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_cons, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)
cj_anova(s1s3_combined_conjoint_cons_ranks, selected ~ `Anti-elitism`+`People-centrism`+Filler, by = ~Sample)


### Figure I1: Difference between Sample 1 and Sample 3 for RQ1/H1 (Binary)

# Top Panels: People-Centrism Outcome (Binary)

# Model and Differences in MM 
out_mm_s1s3_comb_conjoint_listen_single <- cj(na.omit(s1s3_combined_conjoint_listen), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_listen_diff_mms <- cj(na.omit(s1s3_combined_conjoint_listen), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                           by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_listen_single <- plot(out_mm_s1s3_comb_conjoint_listen_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_listen_diff_mms <- plot(s1s3_listen_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_listen_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_s1s3_listen_diff_mms <- plot_s1s3_listen_diff_mms+ theme(axis.title.y=element_blank(),
                                                              axis.text.y=element_blank(),
                                                              axis.ticks.y=element_blank())

# Bottom Panels: Anti-Elitism Outcome (Binary)

# Model and Differences in MM 
out_mm_s1s3_comb_conjoint_crooked_single <- cj(na.omit(s1s3_combined_conjoint_crooked), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_crooked_diff_mms <- cj(na.omit(s1s3_combined_conjoint_crooked), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                            by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_crooked_single <- plot(out_mm_s1s3_comb_conjoint_crooked_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_crooked_diff_mms <- plot(s1s3_crooked_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_crooked_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_s1s3_crooked_diff_mms <- plot_s1s3_crooked_diff_mms+ theme(axis.title.y=element_blank(),
                                                                axis.text.y=element_blank(),
                                                                axis.ticks.y=element_blank())

figI1 <- ggarrange(plot_out_mm_s1s3_comb_conjoint_listen_single, plot_s1s3_listen_diff_mms, plot_out_mm_s1s3_comb_conjoint_crooked_single, plot_s1s3_crooked_diff_mms, ncol=2) 


ggsave("figI1.pdf",
       figI1,
       width = 12,
       height = 9)
  
  
### Figure I2: Difference between Sample 1 and Sample 3 for RQ1/H1 (Rating)
  
# Top Panels: People-Centrism Outcome (Ratings)

# Model and Differences in MM 
out_mm_s1s3_comb_conjoint_listen_ranks_single <- cj(na.omit(s1s3_combined_conjoint_listen_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_listen_ranks_diff_mms <- cj(na.omit(s1s3_combined_conjoint_listen_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                                 by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_listen_ranks_single <- plot(out_mm_s1s3_comb_conjoint_listen_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_listen_ranks_diff_mms <- plot(s1s3_listen_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_listen_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_s1s3_listen_ranks_diff_mms <- plot_s1s3_listen_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                                          axis.text.y=element_blank(),
                                                                          axis.ticks.y=element_blank())

# Bottom Panels: Anti-Elitism Outcome (Ratings)

# Model and Differences in MM 
out_mm_s1s3_comb_conjoint_crooked_ranks_single <- cj(na.omit(s1s3_combined_conjoint_crooked_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_crooked_ranks_diff_mms <- cj(na.omit(s1s3_combined_conjoint_crooked_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                                  by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_crooked_ranks_single <- plot(out_mm_s1s3_comb_conjoint_crooked_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_crooked_ranks_diff_mms <- plot(s1s3_crooked_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_crooked_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_s1s3_crooked_ranks_diff_mms <- plot_s1s3_crooked_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figI2 <- ggarrange(plot_out_mm_s1s3_comb_conjoint_listen_ranks_single, plot_s1s3_listen_ranks_diff_mms, plot_out_mm_s1s3_comb_conjoint_crooked_ranks_single, plot_s1s3_crooked_ranks_diff_mms, ncol=2) 


ggsave("figI2.pdf",
       figI2,
       width = 12,
       height = 9)
  
### Figure I3: Binary Outcomes for RQ1/H1 (S3)

# Model
out_mm_s3_conjoint_listen <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_listen, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_listen <- plot(out_mm_s3_conjoint_listen, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s3_conjoint_crooked <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_crooked, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_crooked <- plot(out_mm_s3_conjoint_crooked, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_out_mm_s3_conjoint_crooked <- plot_out_mm_s3_conjoint_crooked+ theme(axis.title.y=element_blank(),
                                                                          axis.text.y=element_blank(),
                                                                          axis.ticks.y=element_blank())

figI3 <- ggarrange(plot_out_mm_s3_conjoint_listen, plot_out_mm_s3_conjoint_crooked, ncol=2) 

ggsave("figI3.pdf",
       figI3,
       width = 12,
       height = 6)
  

### Figure I4: Rating Outcomes for RQ1/H1 (S3)

# Model
out_mm_s3_conjoint_listen_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_listen_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_listen_ranks <- plot(out_mm_s3_conjoint_listen_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s3_conjoint_crooked_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_crooked_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_crooked_ranks <- plot(out_mm_s3_conjoint_crooked_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_listen$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_out_mm_s3_conjoint_crooked_ranks <- plot_out_mm_s3_conjoint_crooked_ranks+ theme(axis.title.y=element_blank(),
                                                                                      axis.text.y=element_blank(),
                                                                                      axis.ticks.y=element_blank())

figI4 <- ggarrange(plot_out_mm_s3_conjoint_listen_ranks, plot_out_mm_s3_conjoint_crooked_ranks, ncol=2) 

ggsave("figI4.pdf",
       figI4,
       width = 12,
       height = 6)
  

### Figure I5: Average Marginal Component Effects for RQ1/H1 (S3)

# Model
out_amce_s3_conjoint_listen_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_listen, id = ~respondent, estimate = "amce")
# Plot
plot_amce1_s3 <- plot(out_amce_s3_conjoint_listen_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_listen_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_crooked_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_crooked, id = ~respondent, estimate = "amce")
# Plot
plot_amce2_s3 <-plot(out_amce_s3_conjoint_crooked_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_crooked_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce2_s3 <- plot_amce2_s3+ theme(axis.title.y=element_blank(),
                                      axis.text.y=element_blank(),
                                      axis.ticks.y=element_blank())

# Model
out_amce_s3_conjoint_listen_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_listen_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce3_s3 <- plot(out_amce_s3_conjoint_listen_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived People-Centrism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_listen_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_crooked_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_crooked_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce4_s3 <-plot(out_amce_s3_conjoint_crooked_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Anti-Elitism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_crooked_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce4_s3 <- plot_amce4_s3+ theme(axis.title.y=element_blank(),
                                      axis.text.y=element_blank(),
                                      axis.ticks.y=element_blank())

figI5 <- ggarrange(plot_amce1_s3, plot_amce2_s3, plot_amce3_s3, plot_amce4_s3, ncol=2) 

ggsave("figI5.pdf",
       figI5,
       width = 12,
       height = 8)
  

## Replication of RQ2/H2
  
### Figure I6: Difference between Sample 1 and Sample 3 for RQ2/H2 (Binary)

# Top Panels: Immigration Outcome (Binary)

# Model and Differences in MMs  
out_mm_s1s3_comb_conjoint_immig_single <- cj(na.omit(s1s3_combined_conjoint_immig), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_immig_diff_mms <- cj(na.omit(s1s3_combined_conjoint_immig), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                          by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_immig_single <- plot(out_mm_s1s3_comb_conjoint_immig_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_immig_diff_mms <- plot(s1s3_immig_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_immig_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_s1s3_immig_diff_mms <- plot_s1s3_immig_diff_mms+ theme(axis.title.y=element_blank(),
                                                            axis.text.y=element_blank(),
                                                            axis.ticks.y=element_blank())

# Bottom Panels: Conservatism Outcome (Binary)

# Model and Differences in MMs 
out_mm_s1s3_comb_conjoint_cons_single <- cj(na.omit(s1s3_combined_conjoint_cons), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_cons_diff_mms <- cj(na.omit(s1s3_combined_conjoint_cons), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                         by = ~Sample)

# Plot Model
plot_out_mm_s1s3_comb_conjoint_cons_single <- plot(out_mm_s1s3_comb_conjoint_cons_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_cons_diff_mms <- plot(s1s3_cons_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_cons_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_s1s3_cons_diff_mms <- plot_s1s3_cons_diff_mms+ theme(axis.title.y=element_blank(),
                                                          axis.text.y=element_blank(),
                                                          axis.ticks.y=element_blank())

figI6 <- ggarrange(plot_out_mm_s1s3_comb_conjoint_immig_single, plot_s1s3_immig_diff_mms, plot_out_mm_s1s3_comb_conjoint_cons_single, plot_s1s3_cons_diff_mms, ncol=2)


ggsave("figI6.pdf",
       figI6,
       width = 12,
       height = 9)
  

### Figure I7: Difference between Sample 1 and Sample 3 for RQ2/H2 (Ratings)

# Top Panels: Immigration Outcome (Ratings)

# Model and Differences in MMs 
out_mm_s1s3_comb_conjoint_immig_ranks_single <- cj(na.omit(s1s3_combined_conjoint_immig_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_immig_ranks_diff_mms <- cj(na.omit(s1s3_combined_conjoint_immig_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                                by = ~Sample)

# Plot MMs
plot_out_mm_s1s3_comb_conjoint_immig_ranks_single <- plot(out_mm_s1s3_comb_conjoint_immig_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_immig_ranks_diff_mms <- plot(s1s3_immig_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_immig_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


plot_s1s3_immig_ranks_diff_mms <- plot_s1s3_immig_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                                        axis.text.y=element_blank(),
                                                                        axis.ticks.y=element_blank())


# Bottom Panels: Conservatism Outcome (Ratings)
# Note: These differences need to be compared with caution as the US sample used the liberal-conservative scale whereas the UK sample used the left-right scale.

# Model and Differences in MMs 
out_mm_s1s3_comb_conjoint_cons_ranks_single <- cj(na.omit(s1s3_combined_conjoint_cons_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Sample)
s1s3_cons_ranks_diff_mms <- cj(na.omit(s1s3_combined_conjoint_cons_ranks), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm_diff", 
                               by = ~Sample)

# Plot MMs
plot_out_mm_s1s3_comb_conjoint_cons_ranks_single <- plot(out_mm_s1s3_comb_conjoint_cons_ranks_single, group = "Sample", feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (Rating)")+
  scale_color_manual(values=c("blue", "grey40"))

# Plot Differences in MMs
plot_s1s3_cons_ranks_diff_mms <- plot(s1s3_cons_ranks_diff_mms, feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0, colour = "gray50", linetype = 'dashed')+
  ggtitle("Difference in MMs")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1s3_comb_conjoint_cons_ranks_single$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_s1s3_cons_ranks_diff_mms <- plot_s1s3_cons_ranks_diff_mms+ theme(axis.title.y=element_blank(),
                                                                      axis.text.y=element_blank(),
                                                                      axis.ticks.y=element_blank())


figI7 <- ggarrange(plot_out_mm_s1s3_comb_conjoint_immig_ranks_single, plot_s1s3_immig_ranks_diff_mms, plot_out_mm_s1s3_comb_conjoint_cons_ranks_single, plot_s1s3_cons_ranks_diff_mms, ncol=2) 

ggsave("figI7.pdf",
       figI7,
       width = 12,
       height = 9)
  

### Figure I8: Binary Outcomes for RQ2/H2 (S3)

# Model
out_mm_s3_conjoint_immig <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_immig <- plot(out_mm_s3_conjoint_immig, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Position (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_immig$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s3_conjoint_cons <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_cons <- plot(out_mm_s3_conjoint_cons, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_cons$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_out_mm_s3_conjoint_cons <- plot_out_mm_s3_conjoint_cons+ theme(axis.title.y=element_blank(),
                                                                    axis.text.y=element_blank(),
                                                                    axis.ticks.y=element_blank())

figI8 <- ggarrange(plot_out_mm_s3_conjoint_immig, plot_out_mm_s3_conjoint_cons, ncol=2)

ggsave("figI8.pdf",
       figI8,
       width = 12,
       height = 6)
  

### Figure I9: Rating Outcomes for RQ2/H2 (S3)

# Model
out_mm_s3_conjoint_immig_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_immig <- plot(out_mm_s3_conjoint_immig_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Position (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_immig_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_mm_s3_conjoint_cons_ranks <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons_ranks, id = ~respondent, estimate = "mm")
# Plot
plot_out_mm_s3_conjoint_cons <- plot(out_mm_s3_conjoint_cons_ranks, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s3_conjoint_cons_ranks$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

plot_out_mm_s3_conjoint_cons <- plot_out_mm_s3_conjoint_cons+ theme(axis.title.y=element_blank(),
                                                                    axis.text.y=element_blank(),
                                                                    axis.ticks.y=element_blank())

figI9 <- ggarrange(plot_out_mm_s3_conjoint_immig, plot_out_mm_s3_conjoint_cons, ncol=2) 

ggsave("figI9.pdf",
       figI9,
       width = 12,
       height = 6)
  

### Figure I10: Average Marginal Component Effects for RQ2/H2 (S3)

# Model
out_amce_s3_conjoint_immig_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_S3 <- plot(out_amce_s3_conjoint_immig_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_immig_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_cons_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_S3 <-plot(out_amce_s3_conjoint_cons_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_cons_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_S3 <- plot_amce_cons_S3+ theme(axis.title.y=element_blank(),
                                              axis.text.y=element_blank(),
                                              axis.ticks.y=element_blank())

# Model
out_amce_s3_conjoint_immig_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_ranks_S3 <- plot(out_amce_s3_conjoint_immig_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_immig_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_cons_ranks_amce <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons_ranks, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_ranks_S3 <-plot(out_amce_s3_conjoint_cons_ranks_amce, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S3)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_cons_ranks_amce$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_ranks_S3 <- plot_amce_cons_ranks_S3+ theme(axis.title.y=element_blank(),
                                                          axis.text.y=element_blank(),
                                                          axis.ticks.y=element_blank())

figI10 <- ggarrange(plot_amce_immig_S3, plot_amce_cons_S3, plot_amce_immig_ranks_S3, plot_amce_cons_ranks_S3, ncol=2) 

ggsave("figI10.pdf",
       figI10,
       width = 12,
       height = 8)
  

### Figure I11: Average Marginal Component Effects for RQ2/H2 (S3) using Alternative Baseline

# Model
out_amce_s3_conjoint_immig_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_S3_b <- plot(out_amce_s3_conjoint_immig_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (S3, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_immig_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_cons_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_S3_b <-plot(out_amce_s3_conjoint_cons_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (S3, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_cons_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_S3_b <- plot_amce_cons_S3_b+ theme(axis.title.y=element_blank(),
                                                  axis.text.y=element_blank(),
                                                  axis.ticks.y=element_blank())

# Model
out_amce_s3_conjoint_immig_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_immig_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_immig_ranks_S3_b <- plot(out_amce_s3_conjoint_immig_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Immigration Position (Rating, S3, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_immig_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Model
out_amce_s3_conjoint_cons_ranks_amce_b <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s3_conjoint_cons_ranks_b, id = ~respondent, estimate = "amce")
# Plot
plot_amce_cons_ranks_S3_b <-plot(out_amce_s3_conjoint_cons_ranks_amce_b, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("AMCE: Perceived Conservatism (Rating, S3, B2)")+
  scale_colour_manual(values=rep("black", length(unique(out_amce_s3_conjoint_cons_ranks_amce_b$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

plot_amce_cons_ranks_S3_b <- plot_amce_cons_ranks_S3_b+ theme(axis.title.y=element_blank(),
                                                              axis.text.y=element_blank(),
                                                              axis.ticks.y=element_blank())

figI11 <- ggarrange(plot_amce_immig_S3_b, plot_amce_cons_S3_b, plot_amce_immig_ranks_S3_b, plot_amce_cons_ranks_S3_b, ncol=2) 

ggsave("figI11.pdf",
       figI11,
       width = 12,
       height = 8)
  
## Replication of RQ4 

# Load UK Partisanship Data (dataset was created using script_02)
partisanship_df_UK <- read.csv('partisanship_df_UK.csv', header=T, stringsAsFactors = T)




# Merge Conjoint and Partisanship Data (S3)
s3_conjoint_listen_pid <- left_join(s3_conjoint_listen, partisanship_df_UK, by = "Response.ID")
s3_conjoint_listen_ranks_pid <- left_join(s3_conjoint_listen_ranks, partisanship_df_UK, by = "Response.ID")
s3_conjoint_crooked_pid <- left_join(s3_conjoint_crooked, partisanship_df_UK, by = "Response.ID")
s3_conjoint_crooked_ranks_pid <- left_join(s3_conjoint_crooked_ranks, partisanship_df_UK, by = "Response.ID")
s3_conjoint_immig_pid <- left_join(s3_conjoint_immig, partisanship_df_UK, by = "Response.ID")
s3_conjoint_immig_ranks_pid <- left_join(s3_conjoint_immig_ranks, partisanship_df_UK, by = "Response.ID")
s3_conjoint_cons_pid <- left_join(s3_conjoint_cons, partisanship_df_UK, by = "Response.ID")
s3_conjoint_cons_ranks_pid <- left_join(s3_conjoint_cons_ranks, partisanship_df_UK, by = "Response.ID")

# Formal Test of Heterogeneity by Partisanship (S3)
cj_anova(na.omit(s3_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)
cj_anova(na.omit(s3_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`, by = ~PID)


# Load UK Populist Attitudes Data (dataset was created using script_02)
populism_df_UK <- read.csv('populism_df_UK.csv', header=T, stringsAsFactors = T)

# Merge Conjoint and Populism Data (S3)
s3_conjoint_listen_pop <- left_join(s3_conjoint_listen, populism_df_UK, by = "Response.ID")
s3_conjoint_listen_ranks_pop <- left_join(s3_conjoint_listen_ranks, populism_df_UK, by = "Response.ID")
s3_conjoint_crooked_pop <- left_join(s3_conjoint_crooked, populism_df_UK, by = "Response.ID")
s3_conjoint_crooked_ranks_pop <- left_join(s3_conjoint_crooked_ranks, populism_df_UK, by = "Response.ID")
s3_conjoint_immig_pop <- left_join(s3_conjoint_immig, populism_df_UK, by = "Response.ID")
s3_conjoint_immig_ranks_pop <- left_join(s3_conjoint_immig_ranks, populism_df_UK, by = "Response.ID")
s3_conjoint_cons_pop <- left_join(s3_conjoint_cons, populism_df_UK, by = "Response.ID")
s3_conjoint_cons_ranks_pop <- left_join(s3_conjoint_cons_ranks, populism_df_UK, by = "Response.ID")

# Formal Test of Heterogeneity by Populist Attitudes (S3)
cj_anova(na.omit(s3_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)
cj_anova(na.omit(s3_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`, by = ~Populism_Factor)


### Figure I12: Binary Outcomes for RQ1/H1 (S3) by Partisanship
# Note: Parties with fewer than 50 respondents not plotted

# Model
out_mm_s3_conjoint_listen_pid <- cj(na.omit(s3_conjoint_listen_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_listen_pid <- plot(out_mm_s3_conjoint_listen_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

# Model
out_mm_s3_conjoint_crooked_pid <- cj(na.omit(s3_conjoint_crooked_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_crooked_pid <- plot(out_mm_s3_conjoint_crooked_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

plot_out_mm_s3_conjoint_crooked_pid <- plot_out_mm_s3_conjoint_crooked_pid+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank(),
                                                                                  legend.position = "none")

figI12 <- ggarrange(plot_out_mm_s3_conjoint_listen_pid, plot_out_mm_s3_conjoint_crooked_pid, ncol=2) 

ggsave("figI12.pdf",
       figI12,
       width = 12,
       height = 6)

  
### Figure I13: Rating Outcomes for RQ1/H1 (S3) by Partisanship
# Note: Parties with fewer than 50 respondents not plotted

# Model
out_mm_s3_conjoint_listen_ranks_pid <- cj(na.omit(s3_conjoint_listen_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_listen_ranks_pid <- plot(out_mm_s3_conjoint_listen_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

# Model
out_mm_s3_conjoint_crooked_ranks_pid <- cj(na.omit(s3_conjoint_crooked_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_crooked_ranks_pid <- plot(out_mm_s3_conjoint_crooked_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitism (Rating, S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

plot_out_mm_s3_conjoint_crooked_ranks_pid <- plot_out_mm_s3_conjoint_crooked_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank(),
                                                                                              legend.position = "none")

figI13 <- ggarrange(plot_out_mm_s3_conjoint_listen_ranks_pid, plot_out_mm_s3_conjoint_crooked_ranks_pid, ncol=2)

ggsave("figI13.pdf",
       figI13,
       width = 12,
       height = 6)

  
### Figure I14: Binary Outcomes for RQ2/H2 (S3) by Partisanship
# Note: Parties with fewer than 50 respondents not plotted
  
# Model: Immigration Outcome
out_mm_s3_conjoint_immig_pid <- cj(na.omit(s3_conjoint_immig_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_immig_pid <- plot(out_mm_s3_conjoint_immig_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

# Model: Conservatism Outcome
out_mm_s3_conjoint_cons_pid <- cj(na.omit(s3_conjoint_cons_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_cons_pid <- plot(out_mm_s3_conjoint_cons_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

plot_out_mm_s3_conjoint_cons_pid <- plot_out_mm_s3_conjoint_cons_pid+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank(),
                                                                            legend.position = "none")

figI14 <- ggarrange(plot_out_mm_s3_conjoint_immig_pid, plot_out_mm_s3_conjoint_cons_pid, ncol=2) 

ggsave("figI14.pdf",
       figI14,
       width = 12,
       height = 6)
  
### Figure I15: Rating Outcomes for RQ2/H2 (S3) by Partisanship
# Note: Parties with fewer than 50 respondents not plotted

# Model: Immigration Outcome  
out_mm_s3_conjoint_immig_ranks_pid <- cj(na.omit(s3_conjoint_immig_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_immig_ranks_pid <- plot(out_mm_s3_conjoint_immig_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

# Model: Conservatism Outcome
out_mm_s3_conjoint_cons_ranks_pid <- cj(na.omit(s3_conjoint_cons_ranks_pid), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~PID)
# Plot
plot_out_mm_s3_conjoint_cons_ranks_pid <- plot(out_mm_s3_conjoint_cons_ranks_pid, group = "PID", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S3)")+
  scale_color_manual(values=c("#0087dc", "#008066", "#d50000", "#FDBB30", "black", "#12b6cf"))

plot_out_mm_s3_conjoint_cons_ranks_pid <- plot_out_mm_s3_conjoint_cons_ranks_pid+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank(),
                                                                                        legend.position = "none")

figI15 <- ggarrange(plot_out_mm_s3_conjoint_immig_ranks_pid, plot_out_mm_s3_conjoint_cons_ranks_pid, ncol=2) 

ggsave("figI15.pdf",
       figI15,
       width = 12,
       height = 6)
  

### Figure I16: Binary Outcomes for RQ1/H1 (S3) by Populist Attitudes

# Model: People-Centrism Outcome (Binary) by Populist Attitudes  
out_mm_s3_conjoint_listen_pop <- cj(na.omit(s3_conjoint_listen_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_listen_pop <- plot(out_mm_s3_conjoint_listen_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S3)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Anti-Elitism Outcome (Binary) by Populist Attitudes
out_mm_s3_conjoint_crooked_pop <- cj(na.omit(s3_conjoint_crooked_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_crooked_pop <- plot(out_mm_s3_conjoint_crooked_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S3)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s3_conjoint_crooked_pop <- plot_out_mm_s3_conjoint_crooked_pop+ theme(axis.title.y=element_blank(),
                                                                                  axis.text.y=element_blank(),
                                                                                  axis.ticks.y=element_blank())

figI16 <- ggarrange(plot_out_mm_s3_conjoint_listen_pop, plot_out_mm_s3_conjoint_crooked_pop, ncol=2) 

ggsave("figI16.pdf",
       figI16,
       width = 12,
       height = 6)
  

### Figure I17: Rating Outcomes for RQ1/H1 (S3) by Populist Attitudes

# Model: People-Centrism Outcome (Ratings) by Populist Attitudes  
out_mm_s3_conjoint_listen_ranks_pop <- cj(na.omit(s3_conjoint_listen_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_listen_ranks_pop <- plot(out_mm_s3_conjoint_listen_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived People-Centrism (Rating, S3)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Anti-Elitism Outcome (Ratings) by Populist Attitudes
out_mm_s3_conjoint_crooked_ranks_pop <- cj(na.omit(s3_conjoint_crooked_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_crooked_ranks_pop <- plot(out_mm_s3_conjoint_crooked_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Anti-Elitsm (Rating, S3)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s3_conjoint_crooked_ranks_pop <- plot_out_mm_s3_conjoint_crooked_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())

figI17 <- ggarrange(plot_out_mm_s3_conjoint_listen_ranks_pop, plot_out_mm_s3_conjoint_crooked_ranks_pop, ncol=2) 


ggsave("figI17.pdf",
       figI17,
       width = 12,
       height = 6)
  

### Figure I18: Binary Outcomes for RQ2/H2 (S3) by Populist Attitudes

# Model: Immigration Outcome (Binary) by Populist Attitudes  
out_mm_s3_conjoint_immig_pop <- cj(na.omit(s3_conjoint_immig_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_immig_pop <- plot(out_mm_s3_conjoint_immig_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Stance (S3)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Binary) by Populist Attitudes 
out_mm_s3_conjoint_cons_pop <- cj(na.omit(s3_conjoint_cons_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_cons_pop <- plot(out_mm_s3_conjoint_cons_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S3)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s3_conjoint_cons_pop <- plot_out_mm_s3_conjoint_cons_pop+ theme(axis.title.y=element_blank(),
                                                                            axis.text.y=element_blank(),
                                                                            axis.ticks.y=element_blank())

figI18 <- ggarrange(plot_out_mm_s3_conjoint_immig_pop, plot_out_mm_s3_conjoint_cons_pop, ncol=2)

ggsave("figI18.pdf",
       figI18,
       width = 12,
       height = 6)
  

### Figure I19: Rating Outcomes for RQ2/H2 (S3) by Populist Attitudes

# Model: Immigration Outcome (Ratings) by Populist Attitudes  
out_mm_s3_conjoint_immig_ranks_pop <- cj(na.omit(s3_conjoint_immig_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_immig_ranks_pop <- plot(out_mm_s3_conjoint_immig_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Immigration Stance (Rating, S3)")+
  scale_color_manual(values=c("black", "maroon"))

# Model: Conservatism Outcome (Ratings) by Populist Attitudes 
out_mm_s3_conjoint_cons_ranks_pop <- cj(na.omit(s3_conjoint_cons_ranks_pop), selected ~ `Anti-elitism`+`People-centrism`+Filler, id = ~respondent, estimate = "mm", by = ~Populism_Factor)
# Plot
plot_out_mm_s3_conjoint_cons_ranks_pop <- plot(out_mm_s3_conjoint_cons_ranks_pop, group = "Populism_Factor", feature_headers = FALSE)+
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  ggtitle("Outcome: Perceived Conservatism (Rating, S3)")+
  scale_color_manual(values=c("black", "maroon"))

plot_out_mm_s3_conjoint_cons_ranks_pop <- plot_out_mm_s3_conjoint_cons_ranks_pop+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

figI19 <- ggarrange(plot_out_mm_s3_conjoint_immig_ranks_pop, plot_out_mm_s3_conjoint_cons_ranks_pop, ncol=2) 

ggsave("figI19.pdf",
       figI19,
       width = 12,
       height = 6)


#################################
# Appendix J: Data Quality Checks
#################################

# As noted in Appendix J very few respondents failed the mock vignette check
# The highest failure rate was in S1 where 19 respondents provided an incorrect response (2,7%)
# For illustrative purposes here I show that treatment effects look identical when these respondents are excluded

# Preparing Data: Respondents who got mock vignette question correct in S1

# Binary DV 1: "Say that politicians should always listen to the people"

# Import "Long" Format Conjoint Data
s1_conjoint_listen_attentive <- read.qualtrics('Prolific_US_Raw.csv', responses = c("s1_pair1_choice_1","s1_pair2_choice_1","s1_pair3_choice_1","s1_pair4_choice_1","s1_pair5_choice_1", "s1_pair6_choice_1"), covariates = c("Finished","attent_vignette_out", "Sample"), respondentID = "ResponseId", new.format = TRUE)
s1_conjoint_listen_attentive <- s1_conjoint_listen_attentive[!is.na(s1_conjoint_listen_attentive["selected"]),]
s1_conjoint_listen_attentive <- s1_conjoint_listen_attentive[(s1_conjoint_listen_attentive$Finished==1),]
s1_conjoint_listen_attentive <- s1_conjoint_listen_attentive[(s1_conjoint_listen_attentive$attent_vignette_out==4),]

# Relabeling Partisanship levels as not shown to respondents
table(s1_conjoint_listen_attentive$Partisanship)
s1_conjoint_listen_attentive$Partisanship = "Not shown"

# Relabeling Conjoint Attributes
table(s1_conjoint_listen_attentive$`Anti-elitism`)
levels(s1_conjoint_listen_attentive$`Anti-elitism`) <- c("Control: No anti-elitism statement", "Out-of-touch bureaucrats", "Corrupt elite", "Washington insiders")
table(s1_conjoint_listen_attentive$`People-centrism`)
levels(s1_conjoint_listen_attentive$`People-centrism`) <- c("Control: No people-centrism statement","Honest, hardworking citizens", "American people", "The people")
table(s1_conjoint_listen_attentive$Filler)
levels(s1_conjoint_listen_attentive$Filler) <- c("Children are the future", "Bread-and-butter issues", "Overlooked industries", "Semiconductor manufacturing")

# Binary DV 2: "Say that many people in the political class are crooked"

# Import "Long" Format Conjoint Data
s1_conjoint_crooked_attentive<- read.qualtrics('Prolific_US_Raw.csv', responses = c("s1_pair1_choice_2","s1_pair2_choice_2","s1_pair3_choice_2","s1_pair4_choice_2","s1_pair5_choice_2", "s1_pair6_choice_2"), covariates = c("Finished","attent_vignette_out", "Sample"), respondentID = "ResponseId", new.format = TRUE)
s1_conjoint_crooked_attentive<- s1_conjoint_crooked_attentive[!is.na(s1_conjoint_crooked_attentive["selected"]),]
s1_conjoint_crooked_attentive<- s1_conjoint_crooked_attentive[(s1_conjoint_crooked_attentive$Finished==1),]
s1_conjoint_crooked_attentive <- s1_conjoint_crooked_attentive[(s1_conjoint_crooked_attentive$attent_vignette_out==4),]

# Relabeling Partisanship levels as not shown to respondents
table(s1_conjoint_crooked_attentive$Partisanship)
s1_conjoint_crooked_attentive$Partisanship = "Not shown"

# Relabeling Conjoint Attributes
table(s1_conjoint_crooked_attentive$`Anti-elitism`)
levels(s1_conjoint_crooked_attentive$`Anti-elitism`) <- c("Control: No anti-elitism statement", "Out-of-touch bureaucrats", "Corrupt elite", "Washington insiders")
table(s1_conjoint_crooked_attentive$`People-centrism`)
levels(s1_conjoint_crooked_attentive$`People-centrism`) <- c("Control: No people-centrism statement","Honest, hardworking citizens", "American people", "The people")
table(s1_conjoint_crooked_attentive$Filler)
levels(s1_conjoint_crooked_attentive$Filler) <- c("Children are the future", "Bread-and-butter issues", "Overlooked industries", "Semiconductor manufacturing")

# Binary DV 3: "Say that immigration should be reduced"

# Import "Long" Format Conjoint Data
s1_conjoint_immig_attentive<- read.qualtrics('Prolific_US_Raw.csv', responses = c("s1_pair1_choice_3","s1_pair2_choice_3","s1_pair3_choice_3","s1_pair4_choice_3","s1_pair5_choice_3", "s1_pair6_choice_3"), covariates = c("Finished","attent_vignette_out", "Sample"), respondentID = "ResponseId", new.format = TRUE)
s1_conjoint_immig_attentive<- s1_conjoint_immig_attentive[!is.na(s1_conjoint_immig_attentive["selected"]),]
s1_conjoint_immig_attentive<- s1_conjoint_immig_attentive[(s1_conjoint_immig_attentive$Finished==1),]
s1_conjoint_immig_attentive <- s1_conjoint_immig_attentive[(s1_conjoint_immig_attentive$attent_vignette_out==4),]

# Relabeling Partisanship levels as not shown to respondents
table(s1_conjoint_immig_attentive$Partisanship)
s1_conjoint_immig_attentive$Partisanship = "Not shown"

# Relabeling Conjoint Attributes
table(s1_conjoint_immig_attentive$`Anti-elitism`)
levels(s1_conjoint_immig_attentive$`Anti-elitism`) <- c("Control: No anti-elitism statement", "Out-of-touch bureaucrats", "Corrupt elite", "Washington insiders")
table(s1_conjoint_immig_attentive$`People-centrism`)
levels(s1_conjoint_immig_attentive$`People-centrism`) <- c("Control: No people-centrism statement","Honest, hardworking citizens", "American people", "The people")
table(s1_conjoint_immig_attentive$Filler)
levels(s1_conjoint_immig_attentive$Filler) <- c("Children are the future", "Bread-and-butter issues", "Overlooked industries", "Semiconductor manufacturing")


# Binary DV 4: "Have conservative ideology"

# Import "Long" Format Conjoint Data
s1_conjoint_cons_attentive <- read.qualtrics('Prolific_US_Raw.csv', responses = c("s1_pair1_choice_4","s1_pair2_choice_4","s1_pair3_choice_4","s1_pair4_choice_4","s1_pair5_choice_4", "s1_pair6_choice_4"), covariates = c("Finished","attent_vignette_out", "Sample"), respondentID = "ResponseId", new.format = TRUE)
s1_conjoint_cons_attentive <- s1_conjoint_cons_attentive[!is.na(s1_conjoint_cons_attentive["selected"]),]
s1_conjoint_cons_attentive <- s1_conjoint_cons_attentive[(s1_conjoint_cons_attentive$Finished==1),]
s1_conjoint_cons_attentive <- s1_conjoint_cons_attentive[(s1_conjoint_cons_attentive$attent_vignette_out==4),]

# Relabeling Partisanship levels as not shown to respondents
table(s1_conjoint_cons_attentive$Partisanship)
s1_conjoint_cons_attentive$Partisanship = "Not shown"

# Relabeling Conjoint Attributes
table(s1_conjoint_cons_attentive$`Anti-elitism`)
levels(s1_conjoint_cons_attentive$`Anti-elitism`) <- c("Control: No anti-elitism statement", "Out-of-touch bureaucrats", "Corrupt elite", "Washington insiders")
table(s1_conjoint_cons_attentive$`People-centrism`)
levels(s1_conjoint_cons_attentive$`People-centrism`) <- c("Control: No people-centrism statement","Honest, hardworking citizens", "American people", "The people")
table(s1_conjoint_cons_attentive$Filler)
levels(s1_conjoint_cons_attentive$Filler) <- c("Children are the future", "Bread-and-butter issues", "Overlooked industries", "Semiconductor manufacturing")

# Running models for attentive respondents only

# DV 1:
out_mm_s1_conjoint_listen_attentive <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_listen_attentive, id = ~respondent, estimate = "mm")
# DV 2:
out_mm_s1_conjoint_crooked_attentive <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_crooked_attentive, id = ~respondent, estimate = "mm")
# DV 3:
out_mm_s1_conjoint_immig_attentive <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_immig_attentive, id = ~respondent, estimate = "mm")
# DV 4:
out_mm_s1_conjoint_cons_attentive <- cj(selected ~ `Anti-elitism`+`People-centrism`+Filler, data = s1_conjoint_cons_attentive, id = ~respondent, estimate = "mm")





### Figure J1: Binary Outcomes for Perceived People-Centrism Outcome (S1) by Attention

# This figure requires script_05 to have been run for full sample results

# DV 1: Attentive plot
plot_out_mm_s1_conjoint_listen_attentive <- plot(out_mm_s1_conjoint_listen_attentive, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived People-Centrism (S1, Attentive)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_listen_attentive$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Remove labels to combine plot
plot_out_mm_s1_conjoint_listen_attentive <- plot_out_mm_s1_conjoint_listen_attentive+ theme(axis.title.y=element_blank(),
                                                                                            axis.text.y=element_blank(),
                                                                                            axis.ticks.y=element_blank())

# Combine full sample and attentive sample panels
figJ1 <- ggarrange(plot_out_mm_s1_conjoint_listen, plot_out_mm_s1_conjoint_listen_attentive, ncol=2)

ggsave("figJ1.pdf",
       figJ1,
       width = 12,
       height = 6)
  
### Figure J2: Binary Outcomes for Perceived Anti-Elitism Outcome (S1) by Attention

# This figure requires script_05 to have been run for full sample results
  
# DV 2: Attentive plot
plot_out_mm_s1_conjoint_crooked_attentive <- plot(out_mm_s1_conjoint_crooked_attentive, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Anti-Elitism (S1, Attentive)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_listen_attentive$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 

# Remove labels to combine plot
plot_out_mm_s1_conjoint_crooked_attentive <- plot_out_mm_s1_conjoint_crooked_attentive+ theme(axis.title.y=element_blank(),
                                                                                              axis.text.y=element_blank(),
                                                                                              axis.ticks.y=element_blank())
# Combine full sample and attentive sample panels
figJ2 <- ggarrange(plot_out_mm_s1_conjoint_crooked, plot_out_mm_s1_conjoint_crooked_attentive, ncol=2)

ggsave("figJ2.pdf",
       figJ2,
       width = 12,
       height = 6)
  
### Figure J3: Binary Outcomes for Perceived Immigration Stance Outcome (S1) by Attention

# This figure requires script_05 to have been run for full sample results
  
# DV 3: Attentive plot
plot_out_mm_s1_conjoint_immig_attentive <- plot(out_mm_s1_conjoint_immig_attentive, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Immigration Position (S1, Attentive)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_immig_attentive$feature))),
                      guide=FALSE)+
  guides(colour=FALSE)

# Remove labels to combine plot
plot_out_mm_s1_conjoint_immig_attentive <- plot_out_mm_s1_conjoint_immig_attentive+ theme(axis.title.y=element_blank(),
                                                                                          axis.text.y=element_blank(),
                                                                                          axis.ticks.y=element_blank())

# Combine full sample and attentive sample panels
figJ3 <- ggarrange(plot_out_mm_s1_conjoint_immig, plot_out_mm_s1_conjoint_immig_attentive, ncol=2) 

ggsave("figJ3.pdf",
       figJ3,
       width = 12,
       height = 6)
  
### Figure J4: Binary Outcomes for Perceived Conservatism Outcome (S1) by Attention

# This figure requires script_05 to have been run for full sample results
  
# DV 4: Attentive plot
plot_out_mm_s1_conjoint_cons_attentive <- plot(out_mm_s1_conjoint_cons_attentive, feature_headers = FALSE) +
  ggplot2::facet_wrap(~feature, ncol = 1L,
                      scales = "free_y", strip.position = "right")+
  geom_vline(xintercept=0.5, colour = "gray50", linetype = 'dashed')+
  ggtitle("Outcome: Perceived Conservatism (S1, Attentive)")+
  scale_colour_manual(values=rep("black", length(unique(out_mm_s1_conjoint_cons_attentive$feature))),
                      guide=FALSE)+
  guides(colour=FALSE) 


# Remove labels to combine plot
plot_out_mm_s1_conjoint_cons_attentive <- plot_out_mm_s1_conjoint_cons_attentive+ theme(axis.title.y=element_blank(),
                                                                                        axis.text.y=element_blank(),
                                                                                        axis.ticks.y=element_blank())

# Combine full sample and attentive sample panels
figJ4 <- ggarrange(plot_out_mm_s1_conjoint_cons, plot_out_mm_s1_conjoint_cons_attentive, ncol=2)

ggsave("figJ4.pdf",
       figJ4,
       width = 12,
       height = 6)
























